//
//  YGShoppingCartBLL.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/16.
//

#import "YGShoppingCartBLL.h"
#import "CNHTTPManager.h"
#import "UserInfoManager.h"

@implementation YGShoppingCartBLL

#pragma -获取购物车信息接口  
+ (void)requestShoppingCartInfoSuccess:(void (^)(NSArray<YGGoodsListModel *> * _Nonnull))success fail:(void (^)(NSError * _Nonnull))fail{
    NSString *token = [[UserInfoManager shareInstance] getUserInfo].token;
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    [dic setObject:token forKey:@"token"];
    [[CNHTTPManager shared]GET:YG_SHOPPINGCART_GETMSG_URL parameters:dic success:^(id responeObj) {
        NSArray *data = [responeObj objectForKey:@"data"];
        NSArray *model = [YGGoodsListModel arrayOfModelsFromDictionaries:data];
        if (success) {
            success(model);
        }
        } failure:^(NSError *error, NSString *errorDes) {
            if (fail) {
                fail(error);
            }
        }];
    
}

@end
